package cn.edu.scnu.semart.model.user;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@Data
@ApiModel(description = "用户")
@TableName("user")
public class User {
    // 用户类型枚举
    public enum UserType {
        NORMAL("NORMAL"),
        ADMIN("ADMIN");

        private final String value;
        UserType(String value) {
            this.value = value;
        }
        public String getValue() {
            return value;
        }
    }

    // 用户状态枚举
    public enum UserStatus {
        ACTIVE("ACTIVE"),
        BANNED("BANNED");

        private final String value;
        UserStatus(String value) {
            this.value = value;
        }
        public String getValue() {
            return value;
        }
    }


    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "用户ID")
    private Integer userId;

    @TableField("username")
    @ApiModelProperty(value = "用户名")
    private String username;

    @TableField("password")
    @ApiModelProperty(value = "密码")
    private String password;

    @TableField("email")
    @ApiModelProperty(value = "邮箱")
    private String email;

    @TableField("phone")
    @ApiModelProperty(value = "手机号")
    private String phone;

    @TableField("user_type")
    @ApiModelProperty(value = "用户类型(NORMAL-一般用户 ADMIN-管理员)")
    private UserType userType;

    @TableField("status")
    @ApiModelProperty(value = "用户状态(ACTIVE-正常 BANNED-封禁)")
    private UserStatus status;

    @TableField(value = "created_at", fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    private Date createdAt;

    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间")
    private Date updatedAt;
}